package com.caixin.service.user.command;

import com.caixin.common.validation.IsPhone;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
*创建用户Cmd
*
* @author caixin
* @version 1.0.0
* @date 2021年12月11日 10:08
*/
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("创建用户Cmd")
public class UserAddCmd implements Serializable {
    /**
     * 用户名
     */
    @ApiModelProperty(value="用户名",required = true)
    @Size(min=1,max=50,message = "用户名长度1~50字符！")
    @NotBlank(message = "用户名不能为空!")
    private String userName;
    /**
     * 密码
     */
    @ApiModelProperty(value="密码",required = true)
    @Size(min=20,max=50,message = "密码长度20~50字符！")
    @NotBlank(message = "密码不能为空!")
    private String userPassword;
    /**
     * 创建日期
     */
    @ApiModelProperty(value = "创建日期",required = true)
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime createDate;

    /**
     * 手机号
     */
    @ApiModelProperty(value = "手机号",required = true)
    @IsPhone(required = true,message = "手机号码格式错误！")
    private String phoneNo;
}
